home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-12 | 12.9 KB | 414 lines | [TEXT/PJMM] |
- unit Drag;
-
- { Pascal Interface to the Macintosh Libraries }
-
- { Copyright © Apple Computer Inc. }
- { All Rights Reserved }
-
- { Adapted for use with THINK Pascal 4.0.x by Marco Piovanelli }
-
- interface
- uses
- Types, AppleEvents;
-
- const
-
- { gestalt constants (!!! transplanted from GestaltEqu.p !!!) }
- gestaltDragMgrAttr = 'drag'; { Drag Manager attributes }
- gestaltDragMgrPresent = 0; { Drag Manager is present }
- gestaltDragMgrFloatingWind = 1; { Drag Manager supports floating windows }
- gestaltPPCDragLibPresent = 2; { Drag Manager PPC DragLib is present }
-
- { Drag Manager error codes (!!! transplanted from Errors.p !!!) }
- badDragRefErr = -1850; { unknown drag reference }
- badDragItemErr = -1851; { unknown drag item reference }
- badDragFlavorErr = -1852; { unknown flavor type }
- duplicateFlavorErr = -1853; { flavor type already exists }
- cantGetFlavorErr = -1854; { error while trying to get flavor data }
- duplicateHandlerErr = -1855; { handler already exists }
- handlerNotFoundErr = -1856; { handler not found }
- dragNotAcceptedErr = -1857; { drag was not accepted by receiver }
-
- { Flavor Flags }
- flavorSenderOnly = $00000001; { flavor is available to sender only }
- flavorSenderTranslated = $00000002; { flavor is translated by sender }
- flavorNotSaved = $00000004; { flavor should not be saved }
- flavorSystemTranslated = $00000100; { flavor is translated by system }
-
-
- type
- FlavorFlags = LONGINT;
-
-
- const
- { Drag Attributes }
- dragHasLeftSenderWindow = $00000001; { drag has left the source window since TrackDrag }
- dragInsideSenderApplication = $00000002; { drag is occurring within the sender application }
- dragInsideSenderWindow = $00000004; { drag is occurring within the sender window }
-
-
- type
- DragAttributes = LONGINT;
-
-
- const
- { Special Flavor Types }
- flavorTypeHFS = 'hfs '; { flavor type for HFS data }
- flavorTypePromiseHFS = 'phfs'; { flavor type for promised HFS data }
- flavorTypeDirectory = 'diry';
-
- { Drag Tracking Handler Messages }
- dragTrackingEnterHandler = 1; { drag has entered handler }
- dragTrackingEnterWindow = 2; { drag has entered window }
- dragTrackingInWindow = 3; { drag is moving within window }
- dragTrackingLeaveWindow = 4; { drag has exited window }
- dragTrackingLeaveHandler = 5; { drag has exited handler }
-
-
- type
- DragTrackingMessage = INTEGER;
-
-
- const
- { Drag Drawing Procedure Messages }
- dragRegionBegin = 1; { initialize drawing }
- dragRegionDraw = 2; { draw drag feedback }
- dragRegionHide = 3; { hide drag feedback }
- dragRegionIdle = 4; { drag feedback idle time }
- dragRegionEnd = 5; { end of drawing }
-
-
- type
- DragRegionMessage = INTEGER;
-
-
- const
- { Zoom Acceleration }
- zoomNoAcceleration = 0; { use linear interpolation }
- zoomAccelerate = 1; { ramp up step size }
- zoomDecelerate = 2; { ramp down step size }
-
-
- type
- ZoomAcceleration = INTEGER;
-
- { Drag Manager Data Types }
- DragReference = LONGINT;
-
- ItemReference = LONGINT;
-
- FlavorType = ResType;
-
- { HFS Flavors }
- HFSFlavor = record
- fileType: OSType; { file type }
- fileCreator: OSType; { file creator }
- fdFlags: INTEGER; { Finder flags }
- fileSpec: FSSpec; { file system specification }
- end;
- PromiseHFSFlavor = record
- fileType: OSType; { file type }
- fileCreator: OSType; { file creator }
- fdFlags: INTEGER; { Finder flags }
- promisedFlavor: FlavorType; { promised flavor containing an FSSpec }
- end;
- { Application-Defined Drag Handler Routines }
- DragTrackingHandlerProcPtr = ProcPtr; { FUNCTION DragTrackingHandler(message: DragTrackingMessage; theWindow: WindowPtr; handlerRefCon: UNIV Ptr; theDragRef: DragReference): OSErr; }
- DragTrackingHandlerUPP = UniversalProcPtr;
-
- const
- uppDragTrackingHandlerProcInfo = $00003FA0; { FUNCTION (2 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
-
- function NewDragTrackingHandlerProc (userRoutine: DragTrackingHandlerProcPtr): DragTrackingHandlerUPP;
- inline
- $2E9F;
-
- function CallDragTrackingHandlerProc (message: DragTrackingMessage;
- theWindow: WindowPtr;
- handlerRefCon: univ Ptr;
- theDragRef: DragReference;
- userRoutine: DragTrackingHandlerUPP): OSErr;
- inline
- $205F, $4E90;
-
- type
- DragTrackingHandler = DragTrackingHandlerUPP;
-
- DragReceiveHandlerProcPtr = ProcPtr; { FUNCTION DragReceiveHandler(theWindow: WindowPtr; handlerRefCon: UNIV Ptr; theDragRef: DragReference): OSErr; }
- DragReceiveHandlerUPP = UniversalProcPtr;
-
- const
- uppDragReceiveHandlerProcInfo = $00000FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 2 byte result; }
-
- function NewDragReceiveHandlerProc (userRoutine: DragReceiveHandlerProcPtr): DragReceiveHandlerUPP;
- inline
- $2E9F;
-
- function CallDragReceiveHandlerProc (theWindow: WindowPtr;
- handlerRefCon: univ Ptr;
- theDragRef: DragReference;
- userRoutine: DragReceiveHandlerUPP): OSErr;
- inline
- $205F, $4E90;
-
- type
- DragReceiveHandler = DragReceiveHandlerUPP;
-
- { Application-Defined Routines }
- DragSendDataProcPtr = ProcPtr; { FUNCTION DragSendData(theType: FlavorType; dragSendRefCon: UNIV Ptr; theItemRef: ItemReference; theDragRef: DragReference): OSErr; }
- DragSendDataUPP = UniversalProcPtr;
-
- const
- uppDragSendDataProcInfo = $00003FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
-
- function NewDragSendDataProc (userRoutine: DragSendDataProcPtr): DragSendDataUPP;
- inline
- $2E9F;
-
- function CallDragSendDataProc (theType: FlavorType;
- dragSendRefCon: univ Ptr;
- theItemRef: ItemReference;
- theDragRef: DragReference;
- userRoutine: DragSendDataUPP): OSErr;
- inline
- $205F, $4E90;
-
- type
- DragSendDataProc = DragSendDataUPP;
-
- DragInputProcPtr = ProcPtr; { FUNCTION DragInput(VAR mouse: Point; VAR modifiers: INTEGER; dragInputRefCon: UNIV Ptr; theDragRef: DragReference): OSErr; }
- DragInputUPP = UniversalProcPtr;
-
- const
- uppDragInputProcInfo = $00003FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
-
- function NewDragInputProc (userRoutine: DragInputProcPtr): DragInputUPP;
- inline
- $2E9F;
-
- function CallDragInputProc (var mouse: Point;
- var modifiers: INTEGER;
- dragInputRefCon: univ Ptr;
- theDragRef: DragReference;
- userRoutine: DragInputUPP): OSErr;
- inline
- $205F, $4E90;
-
- type
- DragInputProc = DragInputUPP;
-
- DragDrawingProcPtr = ProcPtr; { FUNCTION DragDrawing(message: DragRegionMessage; showRegion: RgnHandle; showOrigin: Point; hideRegion: RgnHandle; hideOrigin: Point; dragDrawingRefCon: UNIV Ptr; theDragRef: DragReference): OSErr; }
- DragDrawingUPP = UniversalProcPtr;
-
- const
- uppDragDrawingProcInfo = $000FFFA0; { FUNCTION (2 byte param, 4 byte param, 4 byte param, 4 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
-
- function NewDragDrawingProc (userRoutine: DragDrawingProcPtr): DragDrawingUPP;
- inline
- $2E9F;
-
- function CallDragDrawingProc (message: DragRegionMessage;
- showRegion: RgnHandle;
- showOrigin: Point;
- hideRegion: RgnHandle;
- hideOrigin: Point;
- dragDrawingRefCon: univ Ptr;
- theDragRef: DragReference;
- userRoutine: DragDrawingUPP): OSErr;
- inline
- $205F, $4E90;
-
- type
- DragDrawingProc = DragDrawingUPP;
-
- { Drag Manager Routines }
- { Installing and Removing Drag Handlers }
-
- function InstallTrackingHandler (trackingHandler: DragTrackingHandler;
- theWindow: WindowPtr;
- handlerRefCon: univ Ptr): OSErr;
- inline
- $7001, $ABED;
- function InstallReceiveHandler (receiveHandler: DragReceiveHandler;
- theWindow: WindowPtr;
- handlerRefCon: univ Ptr): OSErr;
- inline
- $7002, $ABED;
- function RemoveTrackingHandler (trackingHandler: DragTrackingHandler;
- theWindow: WindowPtr): OSErr;
- inline
- $7003, $ABED;
- function RemoveReceiveHandler (receiveHandler: DragReceiveHandler;
- theWindow: WindowPtr): OSErr;
- inline
- $7004, $ABED;
- { Creating and Disposing Drag References }
- function NewDrag (var theDragRef: DragReference): OSErr;
- inline
- $7005, $ABED;
- function DisposeDrag (theDragRef: DragReference): OSErr;
- inline
- $7006, $ABED;
- { Adding Drag Item Flavors }
- function AddDragItemFlavor (theDragRef: DragReference;
- theItemRef: ItemReference;
- theType: FlavorType;
- dataPtr: univ Ptr;
- dataSize: Size;
- theFlags: FlavorFlags): OSErr;
- inline
- $7007, $ABED;
- function SetDragItemFlavorData (theDragRef: DragReference;
- theItemRef: ItemReference;
- theType: FlavorType;
- dataPtr: univ Ptr;
- dataSize: Size;
- dataOffset: LONGINT): OSErr;
- inline
- $7009, $ABED;
- { Providing Drag Callback Procedures }
- function SetDragSendProc (theDragRef: DragReference;
- sendProc: DragSendDataProc;
- dragSendRefCon: univ Ptr): OSErr;
- inline
- $700A, $ABED;
- function SetDragInputProc (theDragRef: DragReference;
- inputProc: DragInputProc;
- dragInputRefCon: univ Ptr): OSErr;
- inline
- $700B, $ABED;
- function SetDragDrawingProc (theDragRef: DragReference;
- drawingProc: DragDrawingProc;
- dragDrawingRefCon: univ Ptr): OSErr;
- inline
- $700C, $ABED;
- { Performing a Drag }
- function TrackDrag (theDragRef: DragReference; {CONST}
- var theEvent: EventRecord;
- theRegion: RgnHandle): OSErr;
- inline
- $700D, $ABED;
- { Getting Drag Item Information }
- function CountDragItems (theDragRef: DragReference;
- var numItems: INTEGER): OSErr;
- inline
- $700E, $ABED;
- function GetDragItemReferenceNumber (theDragRef: DragReference;
- index: INTEGER;
- var theItemRef: ItemReference): OSErr;
- inline
- $700F, $ABED;
- function CountDragItemFlavors (theDragRef: DragReference;
- theItemRef: ItemReference;
- var numFlavors: INTEGER): OSErr;
- inline
- $7010, $ABED;
- function GetFlavorType (theDragRef: DragReference;
- theItemRef: ItemReference;
- index: INTEGER;
- var theType: FlavorType): OSErr;
- inline
- $7011, $ABED;
- function GetFlavorFlags (theDragRef: DragReference;
- theItemRef: ItemReference;
- theType: FlavorType;
- var theFlags: FlavorFlags): OSErr;
- inline
- $7012, $ABED;
- function GetFlavorDataSize (theDragRef: DragReference;
- theItemRef: ItemReference;
- theType: FlavorType;
- var dataSize: Size): OSErr;
- inline
- $7013, $ABED;
- function GetFlavorData (theDragRef: DragReference;
- theItemRef: ItemReference;
- theType: FlavorType;
- dataPtr: univ Ptr;
- var dataSize: Size;
- dataOffset: LONGINT): OSErr;
- inline
- $7014, $ABED;
- function GetDragItemBounds (theDragRef: DragReference;
- theItemRef: ItemReference;
- var itemBounds: Rect): OSErr;
- inline
- $7015, $ABED;
- function SetDragItemBounds (theDragRef: DragReference;
- theItemRef: ItemReference; {CONST}
- var itemBounds: Rect): OSErr;
- inline
- $7016, $ABED;
- function GetDropLocation (theDragRef: DragReference;
- var dropLocation: AEDesc): OSErr;
- inline
- $7017, $ABED;
- function SetDropLocation (theDragRef: DragReference; {CONST}
- var dropLocation: AEDesc): OSErr;
- inline
- $7018, $ABED;
- { Getting Information About a Drag }
- function GetDragAttributes (theDragRef: DragReference;
- var flags: DragAttributes): OSErr;
- inline
- $7019, $ABED;
- function GetDragMouse (theDragRef: DragReference;
- var mouse: Point;
- var pinnedMouse: Point): OSErr;
- inline
- $701A, $ABED;
- function SetDragMouse (theDragRef: DragReference;
- pinnedMouse: Point): OSErr;
- inline
- $701B, $ABED;
- function GetDragOrigin (theDragRef: DragReference;
- var initialMouse: Point): OSErr;
- inline
- $701C, $ABED;
- function GetDragModifiers (theDragRef: DragReference;
- var modifiers: INTEGER;
- var mouseDownModifiers: INTEGER;
- var mouseUpModifiers: INTEGER): OSErr;
- inline
- $701D, $ABED;
- { Drag Highlighting }
- function ShowDragHilite (theDragRef: DragReference;
- hiliteFrame: RgnHandle;
- inside: BOOLEAN): OSErr;
- inline
- $701E, $ABED;
- function HideDragHilite (theDragRef: DragReference): OSErr;
- inline
- $701F, $ABED;
- function DragPreScroll (theDragRef: DragReference;
- dH: INTEGER;
- dV: INTEGER): OSErr;
- inline
- $7020, $ABED;
- function DragPostScroll (theDragRef: DragReference): OSErr;
- inline
- $7021, $ABED;
- function UpdateDragHilite (theDragRef: DragReference;
- updateRgn: RgnHandle): OSErr;
- inline
- $7022, $ABED;
- { Drag Manager Utilities }
- function WaitMouseMoved (initialMouse: Point): BOOLEAN;
- inline
- $7023, $ABED;
- function ZoomRects ({CONST}
- var fromRect: Rect; {CONST}
- var toRect: Rect;
- zoomSteps: INTEGER;
- acceleration: ZoomAcceleration): OSErr;
- inline
- $7024, $ABED;
- function ZoomRegion (region: RgnHandle;
- zoomDistance: Point;
- zoomSteps: INTEGER;
- acceleration: ZoomAcceleration): OSErr;
- inline
- $7025, $ABED;
-
- implementation
- end.